<template>
  <div class="container">
    <el-form ref="hospital" label-width="120px">
      <el-form-item label="医院省市(区/县)" :inline-message="true">
        <el-select placeholder="选择省">
          <el-option value="1" label="陕西省"></el-option>
          <el-option value="2" label="四川省"></el-option>
          <el-option value="3" label="河南省"></el-option>
          <el-option value="4" label="江苏省"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-select placeholder="选择市">
          <el-option value="1" label="西安市"></el-option>
          <el-option value="2" label="成都市"></el-option>
          <el-option value="3" label="郑州市"></el-option>
          <el-option value="4" label="绵阳市"></el-option>
        </el-select>
      </el-form-item>

      <el-form-item>
        <el-select placeholder="选择区">
          <el-option value="1" label="长安区"></el-option>
          <el-option value="2" label="雁塔区"></el-option>
          <el-option value="3" label="金台区"></el-option>
          <el-option value="4" label="吴中区"></el-option>
        </el-select>
      </el-form-item>

      <el-form-item>
        <el-select placeholder="选择县">
          <el-option value="1" label="长安区"></el-option>
          <el-option value="2" label="雁塔区"></el-option>
          <el-option value="3" label="金台区"></el-option>
          <el-option value="4" label="吴中区"></el-option>
        </el-select>
      </el-form-item>

      <el-form-item label="医院名称" prop="name" style="width: 30%">
        <el-input v-model="hospital.name"></el-input>
      </el-form-item>
      <el-form-item label="医院对接人" prop="region">
        <el-select v-model="hospital.region" placeholder="请选择活动区域">
          <el-option label="区域一" value="shanghai"></el-option>
          <el-option label="区域二" value="beijing"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="设置租金金额" prop="name" style="width: 30%">
        <el-input v-model="hospital.rent"></el-input>
      </el-form-item>
      <el-form-item label="银行卡号" prop="name" style="width: 30%">
        <el-input v-model="hospital.card"></el-input>
      </el-form-item>
      <el-form-item label="收益分成" prop="name" style="width: 30%">
        <el-input v-model="hospital.income"></el-input>
      </el-form-item>

      <el-form-item label="股东">
        <el-select placeholder="--所有人员--">
          <el-option value="1" label="股东"></el-option>
          <el-option value="2" label="一级分销商"></el-option>
          <el-option value="3" label="二级分销商"></el-option>
        </el-select>
      </el-form-item>

      <el-form-item label="一级分销商">
        <el-select placeholder="--所有人员--">
          <el-option value="1" label="股东"></el-option>
          <el-option value="2" label="一级分销商"></el-option>
          <el-option value="3" label="二级分销商"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="二级分销商">
        <el-select placeholder="--所有人员--">
          <el-option value="1" label="股东"></el-option>
          <el-option value="2" label="一级分销商"></el-option>
          <el-option value="3" label="二级分销商"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="updateHospital">提交</el-button>
        <el-button type="primary"
          ><router-link to="/hospital/hospitalList"
            >取消</router-link
          ></el-button
        >
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  data() {
    return {
      hospital: {},
    };
  },
  mounted() {
    var id = this.$route.params.id;
    this.$axios({
      url: `http://localhost:8080/jiapei/hospital/hospitalDetail/${id}`,
      method: "GET",
    }).then((res) => {
      this.hospital = res.data.data.hospital;
    });
  },
  methods: {
    updateHospital() {
        console.log("jsdjajsd");
      this.$axios({
        url: "http://localhost:8080/jiapei/hospital/hospitals",
        method: "PUT",
        data:this.hospital
      }).then((res) => {
        if (res.data.code == 200) {
          this.$message({ message: res.data.message });
          this.$router.push("/hospital/hospitalList");
        } else if (res.data.code == 206) {
          this.$message({ message: res.data.message });
          this.$router.push("/hospital/hospitalList");
        }
      });
    },
  },
};
</script>

<style>
</style>